home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / rbbs_pc / fmsck20.zip / FMSCHECK.BAS next >
BASIC Source File  |  1989-10-16  |  10KB  |  191 lines

  1. DECLARE SUB setup (CONFIG.FILE$, Title$)
  2. CLEAR
  3. Title$ = "The FMS Checker 2.0"
  4. '$DYNAMIC
  5. '****************************************************************************
  6. '*  Although it is permissable for you to modify this program, you may only *
  7. '*  distribute your modifications as external merges to this program and not*
  8. '*  the modified version of this program.  Nor are you permitted to delete  *
  9. '*  copyright notices and credits within this program.                      *
  10. '*       I would greatly appreciate it if you would upload any external     *
  11. '*  merges you design to my BBS at (904) 463-0027 so that I may consider    *
  12. '*  them for inclusion in future releases.  If I use your modifications then*
  13. '*  you will receive due credit for them in the documentation.              *
  14. '*       Also, if any one would like to rewrite the documentation and make  *
  15. '*  it more 'readable and understandable' I would appreciate the effort as  *
  16. '*  much as I would any modifications to the program, as I always find it   *
  17. '*  to be most difficult to write a manual on something on which I know as  *
  18. '*  well as the 'back of my hand' and still get it to make any sense to     *
  19. '*  another person!                                                         *
  20. '*                                                                          *
  21. '*                Thanks----Ethan Poole                                     *
  22. '*                                                                          *
  23. '*  P.S.--To make sure you have the latest and "un-hacked" version, dial up *
  24. '*        my BBS at (904) 463-0027 and download the file FMSCKxx.ZIP, where *
  25. '*        xx is the latest version number (Scan the BBS Directory).         *
  26. '****************************************************************************
  27.  
  28. OPTION BASE 1
  29. ON ERROR GOTO 35
  30.  
  31. DIM FileDir(100) AS STRING
  32. DIM Ext.Cat.Line(23) AS STRING
  33. DIM Ext.Cat.Count AS INTEGER
  34. DIM Yes AS INTEGER, CheckLen AS LONG, Numdirs AS INTEGER, No AS INTEGER
  35. DIM erg AS INTEGER, erg2 AS INTEGER, erg3 AS INTEGER, pfile AS INTEGER, sdir AS INTEGER
  36.  
  37. Yes = 1
  38. No = 0
  39.  
  40. CLS
  41. CONFIG.FILE$ = "TFMSC.CFG"
  42. IF INSTR(COMMAND$, "\") THEN CONFIG.FILE$ = COMMAND$
  43. IF RIGHT$(CONFIG.FILE$, 1) = "\" THEN CONFIG.FILE$ = CONFIG.FILE$ + "TFMSC.CFG"
  44. 10 OPEN CONFIG.FILE$ FOR INPUT ACCESS READ AS #1 LEN = 4096
  45.      LINE INPUT #1, ID$
  46.      LINE INPUT #1, FMSDir$
  47.      LINE INPUT #1, ListFile$
  48.      LINE INPUT #1, WarningFile$
  49.      LINE INPUT #1, SysopDir$
  50.      LINE INPUT #1, SysLineDef$
  51.      DO
  52.           Numdirs% = Numdirs% + 1
  53.           LINE INPUT #1, FileDir$(Numdirs%)
  54.           FileDir$(Numdirs%) = LTRIM$(RTRIM$(FileDir$(Numdirs%)))
  55.           IF RIGHT$(FileDir$(Numdirs%), 1) <> "\" THEN FileDir$(Numdirs%) = FileDir$(Numdirs%) + "\"
  56.      LOOP UNTIL EOF(1)
  57.    CLOSE #1
  58.  
  59. 12   IF UCASE$(FMSDir$) = UCASE$(ListFile$) OR UCASE$(FMSDir$) = UCASE$(WarningFile$) OR UCASE$(ListFile$) = UCASE$(WarningFile$) OR ID$ <> Title$ THEN ERROR 53
  60.          
  61.           CLS : LOCATE 5
  62.           PRINT "  The FMS Checker 2.0 developed by Ethan Poole of the EHP Software Exchange"
  63.           PRINT "             [data] (904) 463-0027 or [voice] (904) 463-6108"
  64.           PRINT
  65.           PRINT "       If you find this program to be useful, a $15 dollar registration"
  66.           PRINT "     is requested to help fund the development of this and other programs"
  67.           PRINT
  68.           PRINT "                Please make checks payable to ETHAN POOLE"
  69.           PRINT "                                and mail to:"
  70.           PRINT
  71.           PRINT "                             Ethan Poole"
  72.           PRINT "                             The EHP Software Exchange"
  73.           PRINT "                             P.O. Box 1090"
  74.           PRINT "                             Trenton, FL  32693-1090"
  75.           PRINT
  76.           PRINT "      -- T h e   F M S   C h e c k e r   2 . 0 --     (C)opyright 1989"
  77.        
  78.           n1 = TIMER + 5: DO
  79.           LOOP UNTIL TIMER >= n1
  80.           CLS
  81.  
  82.           n1 = TIMER + 5
  83.           IF UCASE$(SysLineDef$) = "Y" THEN Remove.Sysop.Only = Yes
  84.           LOCATE 10, 7:
  85.                IF Remove.Sysop.Only = No THEN
  86.                     PRINT " Press 'Y' NOW if you wish SysOp-Only Lines to be MOVED.":
  87.                     ELSE PRINT "Press 'N' NOW to Prevent SysOp-Only Lines from being Moved!":
  88.                END IF
  89.           answ = No
  90.           DO
  91.           IF UCASE$(INKEY$) = "Y" THEN Remove.Sysop.Only = Yes: answ = Yes
  92.           IF UCASE$(INKEY$) = "N" THEN Remove.Sysop.Only = No: answ = Yes
  93.           LOOP UNTIL n1 < TIMER OR answ = Yes
  94.           LOCATE 24, 20:
  95.           IF Remove.Sysop.Only = Yes THEN PRINT "MOVING SysOp-Only Lines";
  96.           IF Remove.Sysop.Only = No THEN PRINT "NOT MOVING SysOp-Only Lines";
  97.           VIEW PRINT 1 TO 23
  98.           CLS
  99.           
  100.  
  101. 1    OPEN FMSDir$ FOR INPUT ACCESS READ AS #1 LEN = 15360
  102. 2    OPEN ListFile$ FOR OUTPUT ACCESS WRITE AS #2 LEN = 15360
  103. 3    OPEN WarningFile$ FOR OUTPUT ACCESS WRITE AS #3 LEN = 10240
  104. 4    IF Remove.Sysop.Only = Yes THEN OPEN SysopDir$ FOR APPEND ACCESS READ WRITE AS #5 LEN = 2048
  105.  
  106.  
  107. 20  DO
  108.           x = 1
  109.           FMSLine$ = "": CheckFile$ = "": CheckFile2$ = "": CheckLen& = 0: CheckLength$ = ""
  110.           LINE INPUT #1, FMSLine$
  111.           IF LEFT$(FMSLine$, 1) = "\" THEN PRINT #2, FMSLine$: Ext.Cat.Count = 0: GOTO 50
  112.           IF LEFT$(FMSLine$, 1) = " " THEN Ext.Cat.Count = Ext.Cat.Count + 1: Ext.Cat.Line$(Ext.Cat.Count) = FMSLine$: GOTO 50
  113.           IF LEFT$(FMSLine$, 1) = "/" AND Remove.Sysop.Only = Yes THEN IF Ext.Cat.Count > 0 THEN FOR sgg = 1 TO Ext.Cat.Count: PRINT #5, Ext.Cat.Line$(sgg): NEXT sgg: PRINT #5, FMSLine$: Ext.Cat.Count = 0: erg3 = Yes: GOTO 50:  ELSE PRINT #5,  _
  114. FMSLine$: erg3 = Yes: GOTO 50
  115.           IF LEFT$(FMSLine$, 1) = "/" THEN IF Ext.Cat.Count > 0 AND Remove.Sysop.Only = No THEN FOR xy = 1 TO Ext.Cat.Count: PRINT #2, Ext.Cat.Line$(xy): NEXT xy: PRINT #2, FMSLine$:  ELSE PRINT #2, FMSLine$: Ext.Cat.Count = 0: GOTO 50
  116.           IF LEFT$(FMSLine$, 1) = "*" THEN PRINT #2, FMSLine$: Ext.Cat.Count = 0: GOTO 50
  117.           CheckFile$ = LTRIM$(RTRIM$(LEFT$(FMSLine$, 13))): CheckLength$ = MID$(FMSLine$, 14, 8): CheckLen& = VAL(CheckLength$): CheckFile2$ = LEFT$(FMSLine$, 13)
  118.                IF LEFT$(CheckFile$, 1) = "=" THEN CheckFile$ = MID$(CheckFile$, 2)
  119.                     LOCATE 6, 10: PRINT " Preparing to open file:  " + CheckFile$ + SPACE$(pfile): pfile = LEN(CheckFile$)
  120. 30                  LOCATE 8, 10: PRINT " Searching Directory:  " + FileDir$(x) + SPACE$(sdir): sdir = LEN(FileDir$(x))
  121.                     CLOSE #4: OPEN (FileDir$(x) + CheckFile$) FOR INPUT ACCESS READ AS #4
  122.                     IF CheckLen& <> LOF(4) AND CheckLen& > 0 THEN CheckLength$ = SPACE$(8 - LEN(STR$(LOF(4)))) + STR$(LOF(4)): erg2 = Yes: PRINT #3, CheckFile$; : FOR x = 1 TO (30 - LEN(CheckFile$)): PRINT #3, "."; : NEXT x: PRINT #3,  _
  123. "<File Size Adjusted>"
  124. 40             IF Ext.Cat.Count > 0 THEN FOR xy = 1 TO Ext.Cat.Count: PRINT #2, Ext.Cat.Line$(xy): NEXT xy: Ext.Cat.Count = 0
  125.                PRINT #2, CheckFile2$ + CheckLength$ + "  " + MID$(FMSLine$, 24)
  126.                LOCATE 1, 1: PRINT CheckFile2$ + CheckLength$ + "  " + (MID$(FMSLine$, 24, (LEN(FMSLine$) - 26)))
  127. 50 LOOP UNTIL EOF(1)
  128.  
  129. 35   IF ERR = 61 THEN 900
  130.      IF ERR = 53 THEN IF ERL = 10 OR ERL = 1 OR ERL = 12 THEN CALL setup(CONFIG.FILE$, Title$): RESUME 10
  131.      IF ERR = 53 THEN IF x < Numdirs% THEN x = x + 1: RESUME 30:  ELSE x = 0: Ext.Cat.Count = 0: GOSUB 100: RESUME 50
  132.      RESUME NEXT
  133.  
  134.      CLOSE
  135.         
  136.      VIEW PRINT 1 TO 25
  137.  
  138.      CLS
  139.           x = 10
  140.           a$ = "Missing Files have been detected and logged to " + WarningFile$
  141.           b$ = "Use the DOS Command --> TYPE " + WarningFile$ + " <-- to List Errors!"
  142.           c$ = "Some Files have had their File Sizes Adjusted"
  143.           d$ = "SysOp-Only Lines have been APPENDED TO " + SysopDir$ + "!"
  144.           IF erg3 = Yes THEN LOCATE 6, (INT(80 - LEN(d$)) / 2): PRINT d$
  145.           IF erg = Yes THEN LOCATE 10, (INT(80 - LEN(a$)) / 2): PRINT a$
  146.           IF erg = Yes THEN LOCATE 12, (INT(80 - LEN(b$)) / 2): PRINT b$: x = 16
  147.           IF erg2 = Yes THEN LOCATE x, (INT(80 - LEN(c$)) / 2): PRINT c$
  148.           IF erg2 = Yes AND erg <> Yes THEN LOCATE 12, (INT(80 - LEN(b$)) / 2): PRINT b$
  149.     
  150.      IF erg = No AND erg2 = No THEN KILL WarningFile$
  151.      SYSTEM
  152.  
  153. ErrorHandler:
  154. 100  PRINT #3, CheckFile$ + "<"; : FOR x = 1 TO (14 - LEN(CheckFile$)): PRINT #3, "-"; : NEXT x: PRINT #3, "File Not Found!": erg = Yes
  155. 110  LOCATE 14, 20: PRINT CheckFile$ + "<"; : FOR x = 1 TO (14 - LEN(CheckFile$)): PRINT "-"; : NEXT x: PRINT "File NOT Found! "
  156. 120  RETURN
  157.  
  158. 900  CLS : LOCATE 10, 20: PRINT "ERROR:  DISK FULL.  ABORTING CHECK!": erg = 1: CLOSE : SLEEP 10: SYSTEM
  159.  
  160. REM $STATIC
  161. SUB setup (CONFIG.FILE$, Title$)
  162. CLOSE
  163. 11   CLS
  164.      a$ = "File " + CONFIG.FILE$ + " not found...putting you in setup mode"
  165.      LOCATE 12, (INT(80 - LEN(a$)) / 2): PRINT a$: PRINT : PRINT
  166.      OPEN CONFIG.FILE$ FOR OUTPUT AS #1 LEN = 4096
  167.           LINE INPUT "        Drive, Path, and Filename for FMS MASTER DIR:  "; FMSDir$
  168.           LINE INPUT "  Drive, Path, and Filename for Corrected MASTER DIR:  "; ListFile$
  169.           LINE INPUT "          Drive, Path, and Filename to Log Errors to:  "; WarningFile$
  170.           LINE INPUT "Drive, Path, and Filename to Append SysOp-Only Lines:  "; SysopDir$
  171.           LINE INPUT "Do You wish 'MOVE SYSOP-ONLY LINE' Default to be Yes (Y/N)?  "; SysLineDef$
  172.          
  173.           PRINT #1, Title$
  174.           PRINT #1, FMSDir$
  175.           PRINT #1, ListFile$
  176.           PRINT #1, WarningFile$
  177.           PRINT #1, SysopDir$
  178.           PRINT #1, SysLineDef$
  179.  
  180.           PRINT
  181.  
  182.           FOR z = 1 TO 100
  183.                LINE INPUT "Drive and Directory Containing DL Files (or END to Quit):  "; Temp$
  184.                IF UCASE$(Temp$) = "END" OR Temp$ = "" THEN EXIT FOR
  185.                PRINT #1, Temp$
  186.                Temp$ = ""
  187.           NEXT z
  188.      CLOSE #1
  189. END SUB
  190.  
  191.